/*
 * TelaCadastroUsuario.java
 *
 * Created on 22 de Abril de 2009, 12:17
 */
package asfabdesk.apresentacao;

import asfabdesk.dominio.Data;
import asfabdesk.dominio.NivelAcesso;
import asfabdesk.dominio.Usuario;
import asfabdesk.presistencia.DAO;
import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/**
 *
 * @author  Marco Aurélio
 */
public class TelaCadastroUsuario extends javax.swing.JInternalFrame {

    private Usuario usuario = new Usuario();

    /** Creates new form TelaCadastroUsuario */
    public TelaCadastroUsuario() throws SQLException {
        initComponents();
        configurarJanela();
    }

    public void configurarJanela() throws SQLException {

       

    }

    public void salvar() {
        if (verificarCampos()) {
            if (verificarUniques()) {
                if (compararSenha()) {
                    usuario = povoarUsuario();
                    try {
                        new DAO().salvar(usuario);
                        JOptionPane.showMessageDialog(null, "Usuario Cadastrado com Sucesso'.", "Sucesso", 1);
                        limparCampos();
                    } catch (Exception e) {
                        JOptionPane.showMessageDialog(null, "Ops, ocorreu um erro durante o cadastro'.", "Ops,erro!", 0);
                        e.printStackTrace();
                    }
                }
            }
        }
    }

    public Usuario povoarUsuario() {
        try {
            Usuario user = new Usuario();
            user.setNome(txtNome.getText());
            user.setSobreNome(txtSobrenome.getText());
            user.setCpf(txtCpf.getText());
            user.setRg(txtRg.getText());
            user.setLogin(txtLogin.getText());
            user.setSenha(txtSenha.getText());
            if (comboEfetivo.getSelectedIndex() == 0) {
                user.setEfetivo(false);
            } else {
                user.setEfetivo(true);
            }
            Date data = new Date();
            String dataString = (String) new Data().ConverteDataHoraDateStringBra(data);
            try {
                data = new Data().ConverteDataHoraStringDate(dataString);
            } catch (ParseException ex) {
                Logger.getLogger(TelaConvenio.class.getName()).log(Level.SEVERE, null, ex);
            }
            user.setDataRegistro(data);
            NivelAcesso nivel = new NivelAcesso();
//            nivel = new DAO().localizar(NivelAcesso.class, "NivelPorDescricao", comboNivel.getSelectedItem().toString());
            user.setNivelAcesso(nivel);
//            user.setUsuarioCadastrante();// terminar
            return user;
        } catch (Exception ex) {
            ex.printStackTrace();
            return null;
        }
    }

    public boolean verificarUniques() {
        StringBuffer campos = new StringBuffer();
        String string = "";
        boolean retorno = true;

        if (new DAO().localizar(Usuario.class, "UsuarioPorNomeCompleto", txtNome.getText(), txtSobrenome.getText()) != null) {
            string = " (Nome completo= " + txtNome.getText() + " " + txtSobrenome.getText() + ") ";
            campos.append(string);
            retorno = false;
        }

        if (new DAO().localizar(Usuario.class, "UsuarioPorCpf", txtLogin.getText()) != null) {
            string = " (CPF= " + txtLogin.getText() + ") ";
            campos.append(string);
            retorno = false;
        }

        if (new DAO().localizar(Usuario.class, "UsuarioPorLogin", txtLogin.getText()) != null) {
            string = " (Login= " + txtLogin.getText() + ") ";
            campos.append(string);
            retorno = false;
        }

        if (retorno == false) {
            JOptionPane.showMessageDialog(null, "Ops, você está tentando salvar campo(s) já cadastrado(s): " + '\n' + campos, "Campos Únicos.", 2);
        }
        return retorno;
    }

    public boolean verificarCampos() {
        boolean retorno = true;
        StringBuffer campos = new StringBuffer();
        String str = "";

        if (txtNome.getText().equals("")) {
            str = "(Nome) ";
            campos.append(str);
            retorno = false;
        }

        if (txtSobrenome.getText().equals("")) {
            str = " (Sobrenome) ";
            campos.append(str);
            retorno = false;
        }

        if (txtCpf.getText().equals("   .   .   -  ")) {
            str = " (Sobrenome) ";
            campos.append(str);
            retorno = false;
        }

        if (txtLogin.getText().length() < 4) {
            str = " (Login com menos de 4 caractéres) ";
            campos.append(str);
            retorno = false;
        }

        if (txtSenha.getText().length() < 4) {
            str = " (Senha com menos de 4 caractéres) ";
            campos.append(str);
            retorno = false;
        }


        if (retorno == false) {
            JOptionPane.showMessageDialog(null, "Ops, você não preencheu o(s) seguinte(s) campo(s) obrigatório(s) corretamente: " + '\n' + campos, "Campos Obrigatórios.", 2);
        }
        return retorno;
    }

    public void limparCampos() throws SQLException {
        txtNome.setText("");
        txtSobrenome.setText("");
        txtCpf.setText("");
        txtRg.setText("");
        txtLogin.setText("");
        txtSenha.setText("");
        txtConfirmaSenha.setText("");      
        comboEfetivo.setSelectedIndex(0);
    }
    
    public boolean compararSenha() {
        boolean resultado = false;
        if (txtSenha.getText().equals(txtConfirmaSenha.getText())) {
            resultado = true;
        } else {
            JOptionPane.showMessageDialog(null, "A confirmação da senha não está correta!", "Erro", 0);
        }
        return resultado;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButton1 = new javax.swing.JButton();
        btnSalvar = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jPanel3 = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        ckTelaAssociados = new javax.swing.JCheckBox();
        ckNovoAssociado = new javax.swing.JCheckBox();
        ckAlterarAssociado = new javax.swing.JCheckBox();
        ckAlterarInativarAssociado = new javax.swing.JCheckBox();
        ckNovoDependente = new javax.swing.JCheckBox();
        ckAdesaoConvAssoDep = new javax.swing.JCheckBox();
        ckImprimirFichaAssociado = new javax.swing.JCheckBox();
        ckImprimirRelatorioAssociados = new javax.swing.JCheckBox();
        jPanel5 = new javax.swing.JPanel();
        ckTelaConvenios = new javax.swing.JCheckBox();
        ckNovoCOnvenio = new javax.swing.JCheckBox();
        ckAlterarConvenio = new javax.swing.JCheckBox();
        ckAtivarInativarConvenio = new javax.swing.JCheckBox();
        ckTelaEmpresas = new javax.swing.JCheckBox();
        ckNovaEmpresa = new javax.swing.JCheckBox();
        ckCadSecretaria = new javax.swing.JCheckBox();
        ckCadVinculo = new javax.swing.JCheckBox();
        jPanel6 = new javax.swing.JPanel();
        ckTelaFinanceiro = new javax.swing.JCheckBox();
        ckFiltrarEntradas = new javax.swing.JCheckBox();
        ckNovaEntrada = new javax.swing.JCheckBox();
        ckImprimirEntradas = new javax.swing.JCheckBox();
        ckLancarEntrada = new javax.swing.JCheckBox();
        ckConfirmarEntrada = new javax.swing.JCheckBox();
        ckEstornarEntrada = new javax.swing.JCheckBox();
        ckCancelarEntrada = new javax.swing.JCheckBox();
        ckCancelarSaida = new javax.swing.JCheckBox();
        ckEstornarSaida = new javax.swing.JCheckBox();
        ckConfirmarSaida = new javax.swing.JCheckBox();
        ckLancarSaida = new javax.swing.JCheckBox();
        ckNovaSaida = new javax.swing.JCheckBox();
        ckImprimirSaidas = new javax.swing.JCheckBox();
        ckFiltrarSaidas = new javax.swing.JCheckBox();
        ckFiltrarExtrato = new javax.swing.JCheckBox();
        ckImprimirExtrato = new javax.swing.JCheckBox();
        ckFiltrarConvenios = new javax.swing.JCheckBox();
        ckImprimirConvenio = new javax.swing.JCheckBox();
        ckFiltrarContribuicoes = new javax.swing.JCheckBox();
        ckImprimirContribuicoes = new javax.swing.JCheckBox();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        txtSobrenome = new javax.swing.JTextField();
        txtRg = new javax.swing.JTextField();
        txtLogin = new javax.swing.JTextField();
        txtSenha = new javax.swing.JPasswordField();
        txtConfirmaSenha = new javax.swing.JPasswordField();
        jLabel11 = new javax.swing.JLabel();
        txtNome = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        comboEfetivo = new javax.swing.JComboBox();
        txtCpf = new javax.swing.JFormattedTextField();

        setClosable(true);
        setIconifiable(true);
        setTitle("Cadastro de Usuários");

        jButton1.setText("Cancelar");
        jButton1.setName("jButton1"); // NOI18N
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        btnSalvar.setText("Salvar");
        btnSalvar.setName("btnSalvar"); // NOI18N
        btnSalvar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSalvarActionPerformed(evt);
            }
        });

        jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
        jScrollPane1.setAutoscrolls(true);
        jScrollPane1.setName("jScrollPane1"); // NOI18N

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Nível de Acesso"));
        jPanel3.setName("jPanel3"); // NOI18N

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Operacional"));
        jPanel4.setName("jPanel4"); // NOI18N

        ckTelaAssociados.setText("Tela Associados");
        ckTelaAssociados.setName("ckTelaAssociados"); // NOI18N

        ckNovoAssociado.setText("Novo Associado");
        ckNovoAssociado.setName("ckNovoAssociado"); // NOI18N

        ckAlterarAssociado.setText("Alterar Associado");
        ckAlterarAssociado.setName("ckAlterarAssociado"); // NOI18N

        ckAlterarInativarAssociado.setText("Ativar / Inativar Associado");
        ckAlterarInativarAssociado.setName("ckAlterarInativarAssociado"); // NOI18N

        ckNovoDependente.setText("Novo Dependente");
        ckNovoDependente.setName("ckNovoDependente"); // NOI18N

        ckAdesaoConvAssoDep.setText("Adesão de Convênio Associado/Dependente");
        ckAdesaoConvAssoDep.setName("ckAdesaoConvAssoDep"); // NOI18N

        ckImprimirFichaAssociado.setText("Imprimir Ficha Associado");
        ckImprimirFichaAssociado.setName("ckImprimirFichaAssociado"); // NOI18N

        ckImprimirRelatorioAssociados.setText("Imprimir Relatório de Associados");
        ckImprimirRelatorioAssociados.setName("ckImprimirRelatorioAssociados"); // NOI18N

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(ckImprimirFichaAssociado, javax.swing.GroupLayout.PREFERRED_SIZE, 231, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ckImprimirRelatorioAssociados, javax.swing.GroupLayout.PREFERRED_SIZE, 231, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ckNovoAssociado, javax.swing.GroupLayout.PREFERRED_SIZE, 231, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ckAlterarAssociado, javax.swing.GroupLayout.PREFERRED_SIZE, 231, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ckAlterarInativarAssociado, javax.swing.GroupLayout.PREFERRED_SIZE, 231, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ckNovoDependente, javax.swing.GroupLayout.PREFERRED_SIZE, 231, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ckAdesaoConvAssoDep)
                    .addComponent(ckTelaAssociados, javax.swing.GroupLayout.PREFERRED_SIZE, 231, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(ckTelaAssociados)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckNovoAssociado)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckAlterarAssociado)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckAlterarInativarAssociado)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckNovoDependente)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckAdesaoConvAssoDep)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckImprimirFichaAssociado)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckImprimirRelatorioAssociados)
                .addContainerGap(306, Short.MAX_VALUE))
        );

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Administrativo"));
        jPanel5.setName("jPanel5"); // NOI18N

        ckTelaConvenios.setText("Tela Convênios");
        ckTelaConvenios.setName("ckTelaConvenios"); // NOI18N

        ckNovoCOnvenio.setText("Novo Convênio");
        ckNovoCOnvenio.setName("ckNovoCOnvenio"); // NOI18N

        ckAlterarConvenio.setText("Alterar Convênio");
        ckAlterarConvenio.setName("ckAlterarConvenio"); // NOI18N

        ckAtivarInativarConvenio.setText("Ativar / Inativar Convênio");
        ckAtivarInativarConvenio.setName("ckAtivarInativarConvenio"); // NOI18N

        ckTelaEmpresas.setText("Tela Empresas");
        ckTelaEmpresas.setName("ckTelaEmpresas"); // NOI18N

        ckNovaEmpresa.setText("Nova Empresa");
        ckNovaEmpresa.setName("ckNovaEmpresa"); // NOI18N

        ckCadSecretaria.setText("Cadastrar Secretaria Municipal");
        ckCadSecretaria.setName("ckCadSecretaria"); // NOI18N

        ckCadVinculo.setText("Cadastrar Cat. Vínculo");
        ckCadVinculo.setName("ckCadVinculo"); // NOI18N

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(ckNovaEmpresa)
                    .addComponent(ckTelaEmpresas, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(ckAlterarConvenio, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(ckAtivarInativarConvenio, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(ckCadVinculo, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(ckCadSecretaria, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(ckNovoCOnvenio, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ckTelaConvenios))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(ckTelaConvenios)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckNovoCOnvenio)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckAlterarConvenio)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckAtivarInativarConvenio)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckTelaEmpresas)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckNovaEmpresa)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckCadSecretaria)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckCadVinculo)
                .addContainerGap(306, Short.MAX_VALUE))
        );

        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder("Financeiro"));
        jPanel6.setName("jPanel6"); // NOI18N

        ckTelaFinanceiro.setText("Tela Financeiro");
        ckTelaFinanceiro.setName("ckTelaFinanceiro"); // NOI18N

        ckFiltrarEntradas.setText("Filtrar Entradas");
        ckFiltrarEntradas.setName("ckFiltrarEntradas"); // NOI18N

        ckNovaEntrada.setText("Nova Entrada");
        ckNovaEntrada.setName("ckNovaEntrada"); // NOI18N

        ckImprimirEntradas.setText("Imprimir Relatório Entradas");
        ckImprimirEntradas.setName("ckImprimirEntradas"); // NOI18N

        ckLancarEntrada.setText("Lançar Entrada");
        ckLancarEntrada.setName("ckLancarEntrada"); // NOI18N

        ckConfirmarEntrada.setText("Confirmar Entrada");
        ckConfirmarEntrada.setName("ckConfirmarEntrada"); // NOI18N

        ckEstornarEntrada.setText("Estornar Entrada");
        ckEstornarEntrada.setName("ckEstornarEntrada"); // NOI18N

        ckCancelarEntrada.setText("Cancelar Entrada");
        ckCancelarEntrada.setName("ckCancelarEntrada"); // NOI18N

        ckCancelarSaida.setText("Cancelar Saída");
        ckCancelarSaida.setName("ckCancelarSaida"); // NOI18N

        ckEstornarSaida.setText("Estornar Saída");
        ckEstornarSaida.setName("ckEstornarSaida"); // NOI18N

        ckConfirmarSaida.setText("Confirmar Saída");
        ckConfirmarSaida.setName("ckConfirmarSaida"); // NOI18N

        ckLancarSaida.setText("Lançar Saída");
        ckLancarSaida.setName("ckLancarSaida"); // NOI18N

        ckNovaSaida.setText("Nova Saída");
        ckNovaSaida.setName("ckNovaSaida"); // NOI18N

        ckImprimirSaidas.setText("Imprimir RelatórioSaídas");
        ckImprimirSaidas.setName("ckImprimirSaidas"); // NOI18N

        ckFiltrarSaidas.setText("Filtrar Saídas");
        ckFiltrarSaidas.setName("ckFiltrarSaidas"); // NOI18N

        ckFiltrarExtrato.setText("Filtrar Extrato");
        ckFiltrarExtrato.setName("ckFiltrarExtrato"); // NOI18N

        ckImprimirExtrato.setText("Imprimir Extrato");
        ckImprimirExtrato.setName("ckImprimirExtrato"); // NOI18N

        ckFiltrarConvenios.setText("Filtrar Convênios");
        ckFiltrarConvenios.setName("ckFiltrarConvenios"); // NOI18N

        ckImprimirConvenio.setText("Imprimir Convênio");
        ckImprimirConvenio.setName("ckImprimirConvenio"); // NOI18N

        ckFiltrarContribuicoes.setText("Filtrar Contribuições");
        ckFiltrarContribuicoes.setName("ckFiltrarContribuicoes"); // NOI18N

        ckImprimirContribuicoes.setText("Imprimir Contribuições");
        ckImprimirContribuicoes.setName("ckImprimirContribuicoes"); // NOI18N

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(ckEstornarEntrada, javax.swing.GroupLayout.DEFAULT_SIZE, 163, Short.MAX_VALUE)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(ckConfirmarEntrada)
                            .addComponent(ckConfirmarSaida)
                            .addComponent(ckCancelarSaida, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(ckLancarSaida, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(ckImprimirSaidas, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(ckNovaSaida, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(ckEstornarSaida, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(ckImprimirConvenio)
                            .addComponent(ckFiltrarContribuicoes, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(ckImprimirContribuicoes, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(ckFiltrarExtrato, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(ckImprimirExtrato, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 157, Short.MAX_VALUE)
                                .addComponent(ckFiltrarConvenios, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 157, Short.MAX_VALUE))
                            .addComponent(ckFiltrarSaidas, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(ckNovaEntrada, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(ckLancarEntrada, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(ckCancelarEntrada, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 142, Short.MAX_VALUE))
                            .addComponent(ckFiltrarEntradas, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(ckTelaFinanceiro, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(ckImprimirEntradas))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(ckTelaFinanceiro)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckFiltrarEntradas)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckImprimirEntradas)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckNovaEntrada)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckLancarEntrada)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckConfirmarEntrada)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckEstornarEntrada, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckCancelarEntrada)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckFiltrarSaidas)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckImprimirSaidas)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckNovaSaida)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckLancarSaida)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckConfirmarSaida)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckEstornarSaida)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckCancelarSaida)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckFiltrarExtrato)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckImprimirExtrato)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckFiltrarConvenios)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckImprimirConvenio)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckFiltrarContribuicoes)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckImprimirContribuicoes)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );

        jScrollPane1.setViewportView(jPanel3);

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Dados do Usuário"));
        jPanel1.setName("jPanel1"); // NOI18N

        jLabel1.setText("Sobrenome:");
        jLabel1.setName("jLabel1"); // NOI18N

        jLabel2.setText("CPF:");
        jLabel2.setName("jLabel2"); // NOI18N

        jLabel3.setText("RG:");
        jLabel3.setName("jLabel3"); // NOI18N

        jLabel4.setText("Login:");
        jLabel4.setName("jLabel4"); // NOI18N

        jLabel5.setText("Senha:");
        jLabel5.setName("jLabel5"); // NOI18N

        jLabel6.setText("Confirma Senha:");
        jLabel6.setName("jLabel6"); // NOI18N

        txtSobrenome.setName("txtSobrenome"); // NOI18N

        txtRg.setName("txtRg"); // NOI18N

        txtLogin.setName("txtLogin"); // NOI18N

        txtSenha.setName("txtSenha"); // NOI18N

        txtConfirmaSenha.setName("txtConfirmaSenha"); // NOI18N

        jLabel11.setText("Nome:");
        jLabel11.setName("jLabel11"); // NOI18N

        txtNome.setName("txtNome"); // NOI18N

        jLabel12.setText("Efetivo PMAB:");
        jLabel12.setName("jLabel12"); // NOI18N

        comboEfetivo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "NÃO", "SIM" }));
        comboEfetivo.setName("comboEfetivo"); // NOI18N

        try {
            txtCpf.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("###.###.###-##")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        txtCpf.setName("txtCpf"); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2)
                    .addComponent(jLabel11)
                    .addComponent(jLabel5))
                .addGap(48, 48, 48)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(txtSenha, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(26, 26, 26)
                        .addComponent(jLabel6)
                        .addGap(10, 10, 10)
                        .addComponent(txtConfirmaSenha, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGap(90, 90, 90)
                                .addComponent(comboEfetivo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jLabel12)))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(txtCpf, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jLabel3)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtRg, javax.swing.GroupLayout.DEFAULT_SIZE, 130, Short.MAX_VALUE))
                            .addComponent(txtNome, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 237, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1)
                            .addComponent(jLabel4))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtLogin)
                            .addComponent(txtSobrenome, javax.swing.GroupLayout.DEFAULT_SIZE, 281, Short.MAX_VALUE))))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(txtNome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtSobrenome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(txtCpf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3)
                    .addComponent(txtRg, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4)
                    .addComponent(txtLogin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(txtConfirmaSenha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6)
                    .addComponent(txtSenha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12)
                    .addComponent(comboEfetivo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(13, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(btnSalvar)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jButton1))
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 704, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 249, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnSalvar, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(19, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    dispose();
}//GEN-LAST:event_jButton1ActionPerformed

private void btnSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalvarActionPerformed
    salvar();
}//GEN-LAST:event_btnSalvarActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnSalvar;
    private javax.swing.JCheckBox ckAdesaoConvAssoDep;
    private javax.swing.JCheckBox ckAlterarAssociado;
    private javax.swing.JCheckBox ckAlterarConvenio;
    private javax.swing.JCheckBox ckAlterarInativarAssociado;
    private javax.swing.JCheckBox ckAtivarInativarConvenio;
    private javax.swing.JCheckBox ckCadSecretaria;
    private javax.swing.JCheckBox ckCadVinculo;
    private javax.swing.JCheckBox ckCancelarEntrada;
    private javax.swing.JCheckBox ckCancelarSaida;
    private javax.swing.JCheckBox ckConfirmarEntrada;
    private javax.swing.JCheckBox ckConfirmarSaida;
    private javax.swing.JCheckBox ckEstornarEntrada;
    private javax.swing.JCheckBox ckEstornarSaida;
    private javax.swing.JCheckBox ckFiltrarContribuicoes;
    private javax.swing.JCheckBox ckFiltrarConvenios;
    private javax.swing.JCheckBox ckFiltrarEntradas;
    private javax.swing.JCheckBox ckFiltrarExtrato;
    private javax.swing.JCheckBox ckFiltrarSaidas;
    private javax.swing.JCheckBox ckImprimirContribuicoes;
    private javax.swing.JCheckBox ckImprimirConvenio;
    private javax.swing.JCheckBox ckImprimirEntradas;
    private javax.swing.JCheckBox ckImprimirExtrato;
    private javax.swing.JCheckBox ckImprimirFichaAssociado;
    private javax.swing.JCheckBox ckImprimirRelatorioAssociados;
    private javax.swing.JCheckBox ckImprimirSaidas;
    private javax.swing.JCheckBox ckLancarEntrada;
    private javax.swing.JCheckBox ckLancarSaida;
    private javax.swing.JCheckBox ckNovaEmpresa;
    private javax.swing.JCheckBox ckNovaEntrada;
    private javax.swing.JCheckBox ckNovaSaida;
    private javax.swing.JCheckBox ckNovoAssociado;
    private javax.swing.JCheckBox ckNovoCOnvenio;
    private javax.swing.JCheckBox ckNovoDependente;
    private javax.swing.JCheckBox ckTelaAssociados;
    private javax.swing.JCheckBox ckTelaConvenios;
    private javax.swing.JCheckBox ckTelaEmpresas;
    private javax.swing.JCheckBox ckTelaFinanceiro;
    private javax.swing.JComboBox comboEfetivo;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JPasswordField txtConfirmaSenha;
    private javax.swing.JFormattedTextField txtCpf;
    private javax.swing.JTextField txtLogin;
    private javax.swing.JTextField txtNome;
    private javax.swing.JTextField txtRg;
    private javax.swing.JPasswordField txtSenha;
    private javax.swing.JTextField txtSobrenome;
    // End of variables declaration//GEN-END:variables
}
